﻿@model IEnumerable<ShenLanCMS.Models.Comment>
@{
    ViewBag.Title = "评论管理";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<fieldset>
    <legend>评论管理</legend>
    <br />
    <table>
        <tr>
            <th>
                评论的文章
            </th>
            <th>
                昵称
            </th>
            <th>
                邮箱
            </th>
            <th>
                时间
            </th>
            <th>
                操作
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    <a href="/post/view/@item.PostID" title="@item.GetPost().Title" target="_blank">@item.GetPost().Title</a>
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.NickName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Email)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.CommentTime)
                </td>
                <td>
                    @Html.ActionLink("查看", "Details", new { id = item.CommentID }) | <a href="javascript:delComment('@item.CommentID')">
                        删除</a>
                </td>
            </tr>
        }
    </table>
</fieldset>
<script type="text/javascript">
    function delComment(obj) {
        if (confirm("确定删除该评论吗?")) {
            $.post("/comment/delete/" + obj, function (data) {
                alert(data);
                if (data == "删除成功")
                    window.location.reload();
            });
        }
    }
</script>
